<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="/layout/template.xhtml">

<ui:define name="body">

    <h:form id="administradorGeral" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{administradorGeralHome.managed ? 'Alterar' : 'Cadastro de'} Administrador Geral</f:facet>

			<s:div styleClass="tableControl" rendered="#{empty from}">
        		<s:link view="/resources/AdministradorGeralList.xhtml"
		                    id="list"
		           propagation="none">
		            <h:graphicImage url="/img/list.png"/>
		            #{' '}
		            <h:outputLabel value="Listagem"/>
		        </s:link>
		    </s:div>

			<s:decorate id="nomeField" template="/layout/edit.xhtml">
				<ui:define name="label">Nome</ui:define>
            	<h:inputText value="#{administradorGeralHome.instance.nome}" required="true"/>
			</s:decorate>
			
			<s:decorate id="emailField" template="/layout/edit.xhtml">
				<ui:define name="label">E-mail</ui:define>
            	<h:inputText value="#{administradorGeralHome.instance.email}" required="true">
            		<a:support event="onblur" reRender="emailField" bypassUpdates="true" ajaxSingle="true"/>
            	</h:inputText>
			</s:decorate>
			
			<s:decorate id="statusField" template="/layout/edit.xhtml">
				<ui:define name="label">Status</ui:define>
            	<h:selectOneRadio id="status" value="#{administradorGeralHome.instance.status}" styleClass="radio" >
                    <f:selectItem itemLabel="Ativo" itemValue="Ativo"/>
                    <f:selectItem itemLabel="Inativo" itemValue="Inativo"/>
                </h:selectOneRadio>
			</s:decorate>
            
            <s:decorate id="senhaField" template="/layout/edit.xhtml">
				<ui:define name="label">Senha</ui:define>
            	<h:inputSecret value="#{administradorGeralHome.instance.senha}" required="true"/>
			</s:decorate>

			<s:decorate id="confirmarSenhaField" template="/layout/edit.xhtml">
				<ui:define name="label">Confirmar Senha</ui:define>
            	<h:inputSecret value="#{administradorGeralHome.instance.confirmarSenha}"/>
			</s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                campos obrigatórios
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Salvar"
                         action="#{administradorGeralHome.persist}"
                       disabled="#{!administradorGeralHome.wired}"
                       rendered="#{!administradorGeralHome.managed}"/>

            <h:commandButton id="update"
                          value="Salvar"
                         action="#{administradorGeralHome.update}"
                       rendered="#{administradorGeralHome.managed}"/>

            <h:commandButton id="delete"
                          value="Deletar"
                         action="#{administradorGeralHome.remove}"
                      immediate="true"
                       rendered="#{administradorGeralHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancelar"
             propagation="end"
                    view="/resources/#{empty administradorGeralFrom ? 'AdministradorGeralList' : administradorGeralFrom}.xhtml"
                rendered="#{administradorGeralHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancelar"
             propagation="end"
                    view="/resources/#{empty administradorGeralFrom ? 'AdministradorGeralList' : administradorGeralFrom}.xhtml"
                rendered="#{!administradorGeralHome.managed}"/>

        </div>
    </h:form>

</ui:define>

</ui:composition>
